/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-11-24 22:18:20  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.risk.entity;

import com.joysuch.wwyt.bp.entity.BpJob;
import com.joysuch.wwyt.bp.entity.BpProductionFacility;
import com.joysuch.wwyt.core.entity.BaseUser;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "WWYT_RISK_POINT_EVALUATION_SCL")
@SQLDelete(sql = "update WWYT_RISK_POINT_EVALUATION_SCL set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update WWYT_RISK_POINT_EVALUATION_SCL set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Proxy(lazy = false)
public class RiskPointEvaluationScl implements java.io.Serializable {

    // columns START
    // ID
    private java.lang.Long id;
    // 风险点ID
    private java.lang.Long riskPointId;
    // 分析时间
    private Date analyzeTime;
    // 风险等级
    private java.lang.Integer riskLevel;
    // 受控号
    private java.lang.String inControlNo;
    // 创建人
    private java.lang.Long createBy;
    // 创建时间
    private Date createTime;
    // 更新人
    private java.lang.Long updateBy;
    // 更新时间
    private Date updateTime;
    // 删除标记
    private java.lang.String deleteFlag;
    // 组织机构代码
    private java.lang.String orgCode;
    // 租户
    private java.lang.Long tenentId;
    // columns END

    public void setId(java.lang.Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public java.lang.Long getId() {
        return this.id;
    }

    @Column(name = "RISK_POINT_ID")
    public java.lang.Long getRiskPointId() {
        return this.riskPointId;
    }

    public void setRiskPointId(java.lang.Long value) {
        this.riskPointId = value;
    }

    @Column(name = "ANALYZE_TIME")
    public Date getAnalyzeTime() {
        return this.analyzeTime;
    }

    public void setAnalyzeTime(Date value) {
        this.analyzeTime = value;
    }

    @Column(name = "RISK_LEVEL")
    public java.lang.Integer getRiskLevel() {
        return this.riskLevel;
    }

    public void setRiskLevel(java.lang.Integer value) {
        this.riskLevel = value;
    }

    @Column(name = "IN_CONTROL_NO", length = 20)
    public java.lang.String getInControlNo() {
        return this.inControlNo;
    }

    public void setInControlNo(java.lang.String value) {
        this.inControlNo = value;
    }

    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    public java.lang.Long getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(java.lang.Long value) {
        this.createBy = value;
    }

    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date value) {
        this.createTime = value;
    }

    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    public java.lang.Long getUpdateBy() {
        return this.updateBy;
    }

    public void setUpdateBy(java.lang.Long value) {
        this.updateBy = value;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    public Date getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(Date value) {
        this.updateTime = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public java.lang.String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(java.lang.String value) {
        this.deleteFlag = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public java.lang.String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(java.lang.String value) {
        this.orgCode = value;
    }

    @Column(name = "TENENT_ID")
    public java.lang.Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(java.lang.Long value) {
        this.tenentId = value;
    }

    private BpProductionFacility bpProductionFacility;

    @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
    @JoinColumn(name = "FACILITY_ID")
    public BpProductionFacility getBpProductionFacility() {
        return this.bpProductionFacility;
    }

    public void setBpProductionFacility(BpProductionFacility bpProductionFacility) {
        this.bpProductionFacility = bpProductionFacility;
    }

    private BaseUser baseUser;

    @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
    @JoinColumn(name = "ANALYZE_USER_ID")
    public BaseUser getBaseUser() {
        return this.baseUser;
    }

    public void setBaseUser(BaseUser baseUser) {
        this.baseUser = baseUser;
    }

    private BpJob bpJob;

    @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
    @JoinColumn(name = "JOB_ID")
    public BpJob getBpJob() {
        return this.bpJob;
    }

    public void setBpJob(BpJob bpJob) {
        this.bpJob = bpJob;
    }

    private Set<RiskPointEvaluationSclItem> riskPointEvaluationSclItems = new LinkedHashSet<>(0);

    @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
    @JoinColumn(name = "SCL_EVALUATION_ID")
    public Set<RiskPointEvaluationSclItem> getRiskPointEvaluationSclItems() {
        return this.riskPointEvaluationSclItems;
    }

    public void setRiskPointEvaluationSclItems(Set<RiskPointEvaluationSclItem> riskPointEvaluationSclItems) {
        this.riskPointEvaluationSclItems = riskPointEvaluationSclItems;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
                .append("riskPointId", getRiskPointId()).append("analyzeTime", getAnalyzeTime())
                .append("riskLevel", getRiskLevel()).append("inControlNo", getInControlNo())
                .append("createBy", getCreateBy()).append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime())
                .append("deleteFlag", getDeleteFlag()).append("orgCode", getOrgCode()).append("tenentId", getTenentId())
                .toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof RiskPointEvaluationScl == false)
            return false;
        if (this == obj)
            return true;
        RiskPointEvaluationScl other = (RiskPointEvaluationScl) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
